package cn.wolfcode.mongo.domain;

import lombok.*;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Document("user")         //指定数据库文档所在集合
public class User {

    @Id      //文档中的id使用ObjectId类型来进行封装，并且贴上@id注解
             //自动映射为id，自动封装ObjectId
    private String id;
    private String name;
    private Integer age;
    private List<String> hobby = new ArrayList<>();
}
